package com.job.zhaokaiqiang;

import java.util.Scanner;

/**
 * @author DELL
 * @version 1.0
 * @since 2022-07-04 19:57:04
 */
public class Geam {
    public static void main(String[] args) {
        int n;
        System.out.println("输入要玩的人数");
        Scanner sc = new Scanner(System.in);
        n=sc.nextInt();
        System.out.println(vortroy(n));

    }
    public static int vortroy(int n)
    {
        int[] arr=new int[n];
        for(int i=0;i<arr.length;i++)
        {
            arr[i]=i+1;
        }
        while (arr.length>=3)
        {
            int[] newshuzu=new int[arr.length-1];
            for(int m=3;m<arr.length;m++)
            {
                newshuzu[m-3]=arr[m];
            }
            newshuzu[arr.length-2]=arr[0];
            newshuzu[arr.length-1]=arr[1];
            arr=newshuzu;
        }
        return arr[1];
    }

}
